home *** CD-ROM | disk | FTP | other *** search
/ Aminet 33 / Aminet 33 - October 1999.iso / Aminet / dev / misc / FetchRefs1.3.lha / FetchRefs1.3 / Scripts / FetchRefs.amitex < prev    next >
Encoding:
Text File  |  1999-07-04  |  3.0 KB  |  108 lines

  1. /*  $VER: FetchRefs.amitex 1.02 (27/06/1999)
  2. ** Edit line 64 to locate where you installed FetchRefs
  3. ** Version 1.00 (15 Février 1997)
  4. ** Version 1.01 (23 Mai 1999): modification appel fonction ASK
  5. ** Version 1.02 (27 Juin 1999): suppression appel Cpu060 (Fetchrefs 2.00)
  6. */
  7.  
  8. signal on syntax
  9.  
  10. editorname = 'AMITEX'
  11.  
  12. OPTIONS RESULTS
  13. /* OPTIONS FAILAT 11 */
  14.  
  15. caller = ADDRESS()
  16. if (left(caller, length(editorname)) ~= editorname) then
  17.     exit 10
  18.  
  19. /* Get the function name from editor (get current word). */
  20. 'BLOCK(1)'          /* lecture numéro de ligne début de bloc */
  21. ld = result
  22. if ld<=0 then do
  23.     'WORD(0)'
  24.     function = result
  25. end
  26. else do
  27.     'BLOCK(3)'          /* lecture numéro de ligne de fin */
  28.     lf = result
  29.     if ld ~= lf then do
  30.     'MESSAGE("Sélection incorrecte")'
  31.     exit
  32.     end
  33.     'TEXTMARK(-1)'      /* lecture du bloc marqué */
  34.     function = result
  35. end
  36.  
  37. if function="" then do
  38.     'ASKTEXT("Fonction à chercher ?", "")'
  39.     function = result
  40. end
  41. if function="" then exit
  42.  
  43. /* Définition d'un fichier temporaire pour charger la référence */
  44. cutat = VERIFY(function, "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890_")
  45. if cutat > 0 THEN
  46.     basename = LEFT(function, cutat - 1)
  47. ELSE
  48.     basename = function
  49.  
  50. filename = 'T:FR_'basename
  51.  
  52. /* It doesn''t matter whether we want a taglist, varargs og whatever function */
  53. IF RIGHT(function, 7) = "TagList" THEN
  54.     function = LEFT(function, LENGTH(function) - 7)
  55. ELSE IF RIGHT(function, 4) = "Tags" THEN
  56.     function = LEFT(function, LENGTH(function) - 4)
  57. ELSE IF RIGHT(function, 1) = "A" THEN
  58.     function = LEFT(function, LENGTH(function) - 1)
  59.  
  60. /* Now actually get the reference */
  61. address command
  62. /* 'run c:Cpu060 NI ND NS NB' */
  63. if ~show(p, "FETCHREFS") then do
  64.     'run > nil:' "Prog:docs/FetchRefs/FetchRefs Prog:docs/FetchRefs/FetchRefs.index"
  65.     waitforport "FETCHREFS"
  66. end
  67.  
  68. ADDRESS 'FETCHREFS'
  69. FR_GET function || '(%|Tags|TagList|A)' filename CASE FILEREF
  70. gotoline = rc2
  71. resultat = rc
  72.  
  73. /* Address editor again to load the file */
  74. address value caller
  75. if resultat~=0 then do
  76.     /* Skip if the error was '...!' (actually 'Aborted!'). This occours
  77.      * whenever the 'select from what file' window is closed, which is
  78.      * not really an error.
  79.      */
  80.     if right(rc2, 1) ~='!' then
  81.         /* Reporte l'erreur (passée par FetchRefs) */
  82.         'MESSAGE("Recherche 'function'"+CHR(10)+"'RC2'")'
  83. end
  84. else do
  85.     /* Make the editor open a new window and load the autodoc into it. */
  86.     'OPEN("'filename'")'
  87.  
  88.     /* If FetchRefs provided us with a goto line (it does for .h files
  89.      * only - as it only makes sense for them) then we jump to that line.
  90.      */
  91.     if gotoline ~= 0 then
  92.         'GOTO(1,'gotoline')'
  93.  
  94.     /* Delete the autodoc file */
  95.     ADDRESS COMMAND 'C:Delete >NIL:' filename
  96. end
  97. /* address command
  98. c:Cpu060 I D S B */
  99. exit
  100.  
  101. /* Traitement des erreurs, interruption du programme */
  102. syntax:
  103. erreur=RC
  104. 'MESSAGE("Script FetchRefs.Amitex"+CHR(10)+"Erreur de syntaxe"+CHR(10)+"en ligne 'SIGL'"+CHR(10)+"'errortext(erreur)'")'
  105. address command
  106. /* c:Cpu060 I D S B */
  107. exit
  108.